import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  UseGuards,
} from '@nestjs/common';
import { ZiliaoService } from './ziliao.service';
import { CreateZiliaoDto } from './dto/create-ziliao.dto';
import { UpdateZiliaoDto } from './dto/update-ziliao.dto';
import { JwtAuthGuardAdmin } from '../guard/jwt-auth.guard';

@Controller('/admin/ziliao')
@UseGuards(JwtAuthGuardAdmin)
export class ZiliaoController {
  constructor(private readonly ziliaoService: ZiliaoService) {}

  @Post()
  create(@Body() createZiliaoDto: CreateZiliaoDto) {
    return this.ziliaoService.create(createZiliaoDto);
  }

  @Get()
  findAll() {
    return this.ziliaoService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.ziliaoService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateZiliaoDto: UpdateZiliaoDto) {
    return this.ziliaoService.update(+id, updateZiliaoDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.ziliaoService.remove(+id);
  }
}
